# -*- coding: utf-8 -*-

from datetime import datetime
from pydantic import BaseModel, validator
from typing import Any, Dict

from app.models.request import BaseModelLocal

class PermisionBase(BaseModel):
    parent_id: int | None = None
    name: str | None = None
    desc: str | None = None
    status: int | None = None

class PermisionCreate(PermisionBase):
    pass

class PermisionUpdate(PermisionBase):
    pass

class Permision(PermisionBase, BaseModelLocal):
    class Config:
        from_attributes = True
        
#############################################

class RoleBase(BaseModel):
    parent_id: int | None = None
    name: str | None = None
    desc: str | None = None
    status: int | None = None

class RoleCreate(RoleBase):
    pass
    # create_user: int | None = None

class RoleUpdate(RoleBase):
    # update_user: int | None = None
    # permisions: list[int] | None = None
    pass

class Role(RoleBase, BaseModelLocal):
    class Config:
        from_attributes = True


class RolePersisionIn(BaseModel):
    permisions: list[int] | None = None

class RolePersision(Role):
    permisions: list[Permision] | None = None
    class Config:
        from_attributes = True

#############################################
